Adds up all the numbers target has: array_sum(gold) of 5, 10 and 20 is 35. Use it for the total gold, damage or points.
Works differently on Game Boy - A total on the Game Boy goes round past 32,767 (a total of decimals past 1,023.97), where the Game Boy Advance goes on to billions.
Works differently on Game Boy Color - A total on the Game Boy Color goes round past 32,767 (a total of decimals past 1,023.97), where the Game Boy Advance goes on to billions.
On other consoles this differs: see Side by side and How the consoles differ.
array_sum(target) -> element| Name | Type |
|---|---|
target | array |
element
Adds up all the numbers in target, an array. array_sum(scores) of 7, 3 and 9 is 19. Use it for the total gold, damage or points.
var scores = array_create(3, 0);
scores[0] = 7;
scores[1] = 3;
scores[2] = 9;
var answer = array_sum(scores); // 190, and the game carries on.list_sort_by, then take the first one.One pass over the items.
One pass adding every item. Whole numbers add up as whole numbers (and go wrong past about 2.1 billion); decimals add up as decimals and wrap round past 524,287, like every real sum in GBML. Whole numbers and decimals only; text, yes-or-no values, structs and references are refused when the project is checked. An empty one gives back 0.